package com.zm.zmgz.configure;

import com.zm.zmgz.dao.LogBeanMapper;
import com.zm.zmgz.interceptorzm.MybatisInterceptor;
import org.apache.ibatis.session.SqlSessionFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * Created with IntelliJ IDEA.
 *
 * @Auther: cjw
 * @Date: 2020/04/06/17:32
 * @Description:
 */


@Configuration
public class MybatisInterceptorConfig {

    @Autowired
    LogBeanMapper logBeanMapper;

    @Bean
    public String myInterceptor(SqlSessionFactory sqlSessionFactory) {
        MybatisInterceptor mybatisInterceptor = new MybatisInterceptor(logBeanMapper);
//        Properties properties = new Properties();
//        properties.setProperty("prop1","value1");
//        executorInterceptor.setProperties(properties);
        sqlSessionFactory.getConfiguration().addInterceptor(mybatisInterceptor);
//        sqlSessionFactory.getConfiguration().addInterceptor(new ParamInterceptor());
//        sqlSessionFactory.getConfiguration().addInterceptor(new ResultInterceptor());
        return "interceptor";
    }
}
